package com.csc.banking.model;

// Generated Jul 11, 2014 10:43:16 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Transactiondetails generated by hbm2java
 */
@Entity
@Table(name = "TransactionActions", catalog = "mydb")
public class TransactionAction implements EntityObject, java.io.Serializable
{

	private Long transactionActionId;
	private TransactionType transactionType;
	private Transaction transaction;
	private TransferAction transferAction;
	private Date transactionTime;
	
	private static final long serialVersionUID = 1L;

	public TransactionAction() 
	{
	}

	public TransactionAction(TransactionType transactionType,
			Transaction transaction, Date transactionTime) 
	{
		this.transactionType = transactionType;
		this.transaction = transaction;
		this.transactionTime = transactionTime;
	}
	
	public TransactionAction(TransactionType transactionType,
			Transaction transaction, TransferAction transferAction, Date transactionTime) 
	{
		this.transactionType = transactionType;
		this.transaction = transaction;
		this.setTransferAction(transferAction);
		this.transactionTime = transactionTime;		
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "TransactionActionId", unique = true, nullable = false)
	public Long getTransactionActionId() 
	{
		return this.transactionActionId;
	}

	public void setTransactionActionId(Long transactionActionId) 
	{
		this.transactionActionId = transactionActionId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TransactionTypeId", nullable = false)
	public TransactionType getTransactionType() 
	{
		return this.transactionType;
	}

	public void setTransactionType(TransactionType transactiontype) 
	{
		this.transactionType = transactiontype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TransactionId", nullable = false)
	public Transaction getTransaction() 
	{
		return this.transaction;
	}

	public void setTransaction(Transaction transaction) 
	{
		this.transaction = transaction;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "TransactionTime", nullable = false, length = 19)
	public Date getTransactionTime() 
	{
		return this.transactionTime;
	}

	public void setTransactionTime(Date transactionTime) 
	{
		this.transactionTime = transactionTime;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "transactionAction")
	public TransferAction getTransferAction() 
	{
		return transferAction;
	}
	
	public void setTransferAction(TransferAction transferAction) 
	{
		this.transferAction = transferAction;
	}

}
